package main

import "fmt"


func mapFunc[T any, M any](a []T, f func(T) M) []M {
	n:= make([]M, len(a), cap(a))
	for i, v := range a {
		n[i] = f(v)
	}

	return n
}

func main() {
	vi := []int{1,2,3,4,5,6}
	vs := mapFunc(vi, func (v int) int {
		return v*v
	})
	fmt.Println(vs)
}
